The present invention relates to a gear machine which is operable as pump or motor and which has two pairs of meshing external gears and in which the teeth of one of the gears on the drive shaft are circumferentially displaced from the teeth of the other gear on the drive shaft. In such machines known in the art, the gears are fastened to the drive shaft by a groove and key arrangement. This requires a great effort during mounting of the gears and entails also shortcomings in the transmission of the turning moment.